package com.newblog.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class BaseAction extends Action {
	


	public ActionForward execute1(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		//sdf.do/add?name=df&sdf=123
		StringBuffer buffer =  request.getRequestURL();
		int i = buffer.lastIndexOf("/");
		String sub = buffer.substring(i);
	    String method=  sub.indexOf("?")>=0?buffer.substring(i,sub.indexOf("?")):buffer.substring(i);
		return super.execute(mapping, form, request, response);
	}
	
   /*public static void main(String[] args){
	    String buffer ="df.do/add?wu=1";
	    int i = buffer.lastIndexOf("/");
		String sub = buffer.substring(i);
	    String method=  sub.indexOf("?")>=0?buffer.substring(i,sub.indexOf("?")):buffer.substring(i);
        System.out.println(method);
   }
   */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		  System.out.println("new");
		return null;
	}
	

}
